<template>
  <div class="single-reply">
    <el-avatar :size="36" :src="reply.avatar" class="reply-avatar" />
    <div class="reply-body">
      <div class="reply-header">
        <span class="reply-username">{{ reply.userName }}</span>
        <span class="reply-time">{{ reply.commentDate }}</span>
      </div>
      <div class="reply-content">
        {{ reply.content }}
      </div>
    </div>
  </div>

</template>

<script setup lang="ts">
import type { CommentReply } from '@/utils/dataType/ArticleModel'

import type { PropType } from 'vue'

const props = defineProps({
  reply: {
    type: Object as PropType<CommentReply>,
    required: true,
  },
})
const reply = props.reply
</script>

<style scoped>
.single-reply {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 0;
  max-width: 700px; /* 限制评论宽度 */
  margin: 0 auto; /* 居中显示 */
  border-bottom: 1px solid #f0f0f0;
}

.reply-avatar {
  flex-shrink: 0;
}

.reply-body {
  flex: 1;
}

.reply-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.reply-username {
  font-weight: 500;
  color: #409eff;
  font-size: 14px;
}

.reply-time {
  font-size: 12px;
  color: #999;
}

.reply-content {
  font-size: 14px;
  color: #333;
  line-height: 1.4;
  word-break: break-word;
  text-align: left;
}
</style>
